
import Vue from "vue"

Vue.filter("rolename",(value)=>{
    if(!value) return value
    switch (value) {
        case "1":
        return "医药代表"
        break;
        case "2":
        return "主管"
        break;
        case "3":
        return "经理"
        break;
        case "4":
        return "总监"
        break;
        default:
        return "未知"
        break;
    }
})

Vue.filter("statusname",(value)=>{
    if(!value) return value
    switch (value) {
        case '1':
        return "启用"
        break;
        case '2':
        return "停用"
        break;
        default:
        return "未知"
        break;
    }
})

Vue.filter("colortype1",(value)=>{
    if (!value) return value;
    switch (value) {
        case 1:
        return "success"
        break;
        case 2:
        return "danger"
        break;
        default:
        return ""
        break;
    }
})


Vue.filter("colortype",(value)=>{
    if (!value) return value;
    switch (value) {
        case "1":
        return "success"
        break;
        case "2":
        return "danger"
        break;
        case "3":
        return "warning"
        break;
        case "4":
        return "primary"
        break;
        default:
        return ""
        break;
    }
})


//时间过滤器
import moment from "moment"

Vue.filter("timeFormat",(value,format)=>{
    if(!value) return value;
    format = format || "YYYY-MM-DD HH:mm:ss"
    return moment(value).format(format)
})